# _*_ coding : utf-8 _*_
# @Time : 2023/12/12 10:53
# @Author : 韩宗森
# @File : 30_requests_代理
# @Project : pythonProject

import requests

url = 'http://www.baidu.com/s'

data = {
    'wd': 'ip'
}

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36'
}

# 代理
proxy = {
    'http': '58.220.95.86:9401'
}

# url请求资源路径  params参数  kwargs字典
response = requests.get(url=url, params=data, headers=headers, proxies=proxy)

content = response.text

with open('daili.html', 'w', encoding='utf-8') as fp:
    fp.write(content)
